<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace app\admin\validate;

use think\Validate;

class SpecsValidate extends Validate
{
    protected $rule = [
        'id'            => 'require|number',
        'shop_id'       => 'require|number',
        'specs_name'    => 'require',
        'attr_name'     => 'require',
    ];
    protected $message = [
        'id.require'           => 'id不能为空',
        'id.number'            => 'id必须为数字',
        'shop_id.require'      => '请选择商品分类',
        'shop_id.number'       => '商品分类必须为数字',
        'specs_name.require'   => '规格组名称不能为空',
        'attr_name.require'    => '规格项不能为空',
    ];

    protected $scene = [
        'add'  => ['shop_id','specs_name','attr_name'],
        'edit' => ['id','shop_id','specs_name','attr_name'],
    ];
}